<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

<h:head>
	<link type="text/css" rel="stylesheet" href="#{request.contextPath}/resources/css/styles.css" />
	<title>Crea Nuovo Volo</title>
</h:head>

<h:body>
<div id="header">
	<ui:include src="/resources/snippets/headerDipendente.xhtml"></ui:include>
</div>
	<h1>Crea Nuovo Volo</h1>
	<br/>
	<h:form>
		<h:outputLabel for="codice">Codice Volo:</h:outputLabel>
		<h:inputText id="codice" value="#{volo.current.codice}" />
		<h:message for="codice"></h:message> <br/>
		<br/>
		<h:outputLabel for="compagnia">Nome Compagnia:</h:outputLabel>
		<h:inputText id="compagnia" value="#{volo.current.compagnia}" />
		<h:message for="compagnia"></h:message> <br/>
		<br/>
		<h:outputLabel for="ora">Ora del Volo (HH:MM) :</h:outputLabel>
		<h:inputText id="ora" value="#{volo.current.ora}" />
		<h:message for="ora"></h:message> <br/>
		<br/>
		<h:outputLabel for="cittaPartenza">Città di Partenza:</h:outputLabel>
		<h:inputText id="cittaPartenza" value="#{volo.current.cittaPartenza}" />
		<h:message for="cittaPartenza"></h:message> <br/>
		<br/>
		<h:outputLabel for="cittaArrivo">Città di Arrivo:</h:outputLabel>
		<h:inputText id="cittaArrivo" value="#{volo.current.cittaArrivo}" />
		<h:message for="cittaArrivo"></h:message> <br/>
		<br/>
		<p:commandButton value="Crea Nuovo" action="#{volo.create()}" />
	</h:form>
	<p:dialog id="errVoloDup" header="Volo duplicato" widgetVar="errVoloDup" modal="true">  
    	<h:outputText value="Attenzione: esiste già un volo con questo codice!" /> <br/>
    	<p:commandButton id="errVoloButton" value="Ok" onclick="PF('errVoloDup').hide();" type="button"/>  
	</p:dialog>
	<br/>
	<br/> 
	<br/>
	<h:link outcome="creaProdottoBase" value="Torna Indietro" /> <br/>
	<br/>
	<br/>
	<br/>
<div id="footer">
	<ui:include src="/resources/snippets/footer.xhtml"></ui:include>
</div>	
</h:body>
</html>